package com.example.demo.entity;

import java.util.Date;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.Transient;

import org.springframework.format.annotation.DateTimeFormat;

import com.fasterxml.jackson.annotation.JsonFormat;
/**
 * @author 陶国庆
 *保险公司信息Insurance2--------》保险公司录入名字 Insurance
 */
import com.fasterxml.jackson.annotation.JsonIgnore;
@Entity
public class Insurance2 {
	@Id
	@GeneratedValue
	@JsonIgnore			//作用是json序列化时将java bean中的一些属性忽略掉
	private Integer id;
	//保险公式名字
	@ManyToOne
	private Insurance insurance;
	// 交强险返利点数
	private Float jqxfld;
	// 商业险返利点数
	private Float syxfld;
	/**
	 * 起始日期
	 */
	@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
	@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	@JsonIgnore
	private Date beginDate;
	/**
	 * 结束日期
	 */
	@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
	@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	@JsonIgnore
	private Date endDate;
	public Integer getId() {
		return id;
	}
	public void setId(Integer id) {
		this.id = id;
	}
	public Insurance getInsurance() {
		return insurance;
	}
	public void setInsurance(Insurance insurance) {
		this.insurance = insurance;
	}
	public Float getJqxfld() {
		return jqxfld;
	}
	public void setJqxfld(Float jqxfld) {
		this.jqxfld = jqxfld;
	}
	public Float getSyxfld() {
		return syxfld;
	}
	public void setSyxfld(Float syxfld) {
		this.syxfld = syxfld;
	}
	public Date getBeginDate() {
		return beginDate;
	}
	public void setBeginDate(Date beginDate) {
		this.beginDate = beginDate;
	}
	public Date getEndDate() {
		return endDate;
	}
	public void setEndDate(Date endDate) {
		this.endDate = endDate;
	}
	
	@Transient
	private Integer getInsuranceId() {
		return insurance==null?null:insurance.getId();
	}
	
	@Transient
	private String getName() {
		return insurance==null?null:insurance.getName();
	}
}
